<template>
	<view class="wrap">
		<view>
			<u-form class="form bg-white" ref="uForm" label-position="left">
				<u-form-item label="仓库:" prop="cinvCode" label-width="180" :label-style="{'font-weight':'bold'}">
					<view>{{cwhcode}}</view>
				</u-form-item>
			</u-form>
		</view>
		<view class="bg-white solid-bottom " style="text-align: center;">
			<view class="action text-align" >
				<text style="font-size:large;font: bolder;">区域</text>
			</view>
		</view>
		<scroll-view class="scroll-list bg-white" scroll-y="true" :style="[{height:stockListHeight + 'px'}]">
			<u-grid :col="3">
				<u-grid-item v-for="(item,index) in list" :key="index" @click="hwxz(item)">
					<image src='/static/image/hw.png' style="width: 50px;height: 50px;"></image>
					<view class="grid-text">{{item.cposname}}</view>
				</u-grid-item>
			</u-grid>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				stockListHeight: 0,
				list:[],
				cwhcode:'',
			}
		},
		onLoad(params) {
			this.cwhcode = params.cwhcode;this.loadList();
			var _self = this;
			uni.getSystemInfo({
				success: (e) => { // resu 可以获取当前屏幕的高度
					_self.stockListHeight = e.windowHeight - uni.upx2px(220);
				},
				fail: (res) => {}
			});
		},
		watch: {},
		onShow() {},
		onReady() {
			
		},
		methods: {
			hwxz(item){
				uni.navigateTo({
					url: '/pages/asd/index/cgsj/hw?cposcode=' + item.cposcode+'&cposname='+item.cposname,
				})
			},
			loadList() {
				this.$u.api.basApi.findPosTop({cwhcode:this.cwhcode}).then(res => {
					this.list = res.data;
				})
			},
		}
	}
</script>
<style>
	@import '../asd.css';
</style>
